<?php
/**
 * +----------------------------------------------------------------------
 * | Copyright © Sogu Technologies Co. Ltd 2018-2050 All rights reserved.
 * +----------------------------------------------------------------------
 * | File name: SettingLog.php
 * +----------------------------------------------------------------------
 * | Author: lijiafei
 * +----------------------------------------------------------------------
 * | Description:
 * +----------------------------------------------------------------------
 * | Others: 其他内容的说明
 * +----------------------------------------------------------------------
 * | History:
 * +----------------------------------------------------------------------
 * | 1.Date: 2019/1/8 Author: lijiafei Modification: 创建
 * +----------------------------------------------------------------------
 */

namespace App\Library\Traits;


use App\Events\SettingLogEvent;

Trait SettingLog
{
    public function setting_log($user_id,$table_name,$table_id,$type,$data = []){
        $eventData['admin_id'] = $user_id;
        $eventData['table_name'] = $table_name;
        $eventData['table_id'] = $table_id;
        $eventData['operating_type'] = $type;
        $eventData['data'] = empty($data) ? '' : json_encode($data,JSON_UNESCAPED_UNICODE);
        event(new SettingLogEvent($eventData));
    }

}